<script setup lang="ts">
import {
  workOrderList,
  exportUser,
  controlTaskChange,
  update,
  optionsList,
  updateBox,
  reportShelfWrongDataList,
  handadd,
  deleteBook,
  createpage,
  tenOptions,
} from "@/api/order/index";

import { ElMessage, ElMessageBox } from "element-plus";
import { computed, onMounted, ref, onUnmounted } from "vue";
import useUserStore from "@/store/modules/user";
let useStore = useUserStore();
// const hasRole = (role: any) => {
//   return useStore.user.roles.includes(role);
// };

const libraryList = ref([] as any[]); //列表数据
const queryFormRef = ref(); //refForm
const total = ref();
const ids = ref([]); //表格全选，第一个表格导出用
const loading = ref(false);
let queryParams = ref({
  pageNum: 1,
  pageSize: 10,
} as any);
// 添加定时器变量
const refreshTimer = ref<any>(null);

const resetQuery = () => {
  queryParams.value = { pageNum: 1, pageSize: 10 };
  getList();
};

/**
 * 列表数据
 */
const getList = async () => {
  if (queryParams.value.Time) {
    const [startTime, endTime] = queryParams.value.Time;
    queryParams.value.startTim = startTime;
    queryParams.value.endTime = endTime;
  }

  const res = await workOrderList(queryParams.value);
  libraryList.value = res.data.records!;
  total.value = res.data.total;
};

// 添加自动刷新函数
const startAutoRefresh = () => {
  refreshTimer.value = setInterval(() => {
    getList();
    console.log("自动刷新工单状态...");
  }, 10000); // 10秒刷新一次
};

onMounted(() => {
  getList();
  startAutoRefresh(); // 启动定时刷新
});

// 添加组件卸载时的清理逻辑
onUnmounted(() => {
  if (refreshTimer.value) {
    clearInterval(refreshTimer.value);
    refreshTimer.value = null;
  }
});
/**
 * 导出用户
 */
function handleUserExport() {
  exportUser(ids.value).then((response: any) => {
    const blob = new Blob([response.data], {
      type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8",
    });
    const a = document.createElement("a");
    const href = window.URL.createObjectURL(blob); // 下载的链接
    a.href = href;
    a.download = decodeURI(
      response.headers["content-disposition"].split(";")[1].split("=")[1]
    ); // 获取后台设置的文件名称
    document.body.appendChild(a);
    a.click(); // 点击导出
    document.body.removeChild(a); // 下载完成移除元素
    window.URL.revokeObjectURL(href); // 释放掉blob对象
  });
}
const isSearchDisabled = computed(() => {
  return ids.value.length === 0;
});
// 控制序号
const indexMethod = (index: any) => {
  // 1、index:代表当前行数据的下标
  // 2、下标+1:  分页不要纠结：这块不是业务，完全是数学问题！
  return (
    index + 1 + (queryParams.value.pageNum - 1) * queryParams.value.pageSize
  );
};

const handleSizeChange = (val: number) => {
  queryParams.value.pageSize = val;
  queryParams.value.pageNum = 1;

  getList();
};
const handleCurrentChange = (val: number) => {
  queryParams.value.pageNum = val;
  getList();
  window.scrollTo({ top: 0, behavior: "smooth" }); // 立即回到顶部，并使用平滑滚动效果
};
/**
 * 行checkbox change事件
 */

function handleSelectionChange(selection: any) {
  //console.log(selection, "selection");
  ids.value = selection.map((item: any) => item.workNo);
}
/**
 * 枚举
 */
const workTypeStatus = (status: number) => {
  const STATUSES = [
    { workStatus: 0, name: "手动工单" },
    { workStatus: 1, name: "自动工单" },
  ];
  const matched = STATUSES.find((item) => item.workStatus === status);

  return matched ? matched.name : "";
};
const getbooksStatus = (status: number) => {
  const STATUSES = [
    { workStatus: 3, name: "已过期" },
    { workStatus: 0, name: "待处理" },
    { workStatus: 1, name: "处理中" },
    { workStatus: 2, name: "已完成" },
  ];
  const matched = STATUSES.find((item) => item.workStatus === status);

  return matched ? matched.name : "";
};
const scheduleFormatter = (row: any) => {
  const scheduleValue = Number(row.schedule); // 确保转换为数字
  if (isNaN(scheduleValue)) {
    return "0%"; // 处理 NaN 的情况
  }
  if (scheduleValue >= 1) {
    return "100%"; // 确保最大为 100%
  } else if (scheduleValue < 0) {
    return "0%"; // 确保最小为 0%
  } else {
    return `${(scheduleValue * 100).toFixed(2)}%`;
  }
};
const Start = (row: any) => {
  let numstatus = 1;
  // console.log(row);
  ElMessageBox.confirm("确认开始吗", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  }).then(async () => {
    setTimeout(async () => {
      const res = await controlTaskChange(numstatus, row.id);
      if (res.code === 200) {
        ElMessage.success("已开始！");
        //   // 关闭对话框并重新查询列表数据

        getList();
        loading.value = false;
      } else {
        ElMessage.error(res.msg);
        getList();
      }
    }, 1000); // 延迟1秒
  });
};
const Pause = (row: any) => {
  let numstatus = 2;
  // console.log(row);
  ElMessageBox.confirm("确认暂停吗", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  }).then(async () => {
    setTimeout(async () => {
      const res = await controlTaskChange(numstatus, row.id);
      if (res.code === 200) {
        ElMessage.success("已暂停！");
        //   // 关闭对话框并重新查询列表数据

        getList();
        loading.value = false;
      } else {
        ElMessage.error(res.msg);
        getList();
      }
    }, 1000); // 延迟1秒
  });
};
const Stop = (row: any) => {
  let numstatus = 3;
  //console.log(row);
  ElMessageBox.confirm("确认停止吗", {
    confirmButtonText: "确认",
    cancelButtonText: "取消",
    type: "warning",
  }).then(async () => {
    setTimeout(async () => {
      const res = await controlTaskChange(numstatus, row.id);
      if (res.code === 200) {
        ElMessage.success("已停止！");
        //   // 关闭对话框并重新查询列表数据
        getList();
        loading.value = false;
      } else {
        ElMessage.error(res.msg);
        getList();
      }
    }, 1000); // 延迟1秒
  });
};
const complete = (id: any) => {
  ElMessageBox.confirm("确定要完成工单吗？", "提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  })
    .then(async () => {
      const res = await update(id);
      //console.log(res, "Res");
      if (res.code == 200) {
        ElMessage.success(res.msg);
        getList();
      } else {
        ElMessage.error(res.msg);
      }
    })
    .catch(() => {
      // ElMessage.info("已取消生成工单");
    });
};
const FormParams = ref({} as any);
const FormRef = ref();
const BoxList = ref([] as any);
const dialogVisible = ref(false);
const AssignRowid = ref();
const Assign = async (row: any) => {
  dialogVisible.value = true;
  const res = await optionsList(useStore.encryptedData);
  BoxList.value = res.data;
  AssignRowid.value = row.id;
  //console.log(res, "下拉还书箱", row, "row");
};
const handleClose = () => {
  dialogVisible.value = false;
  FormRef.value.resetFields();
  FormRef.value.clearValidate();
  FormParams.value = {} as any;
};
const sbtAssign = () => {
  dialogVisible.value = true;
  FormRef.value.validate(async (valid: any) => {
    if (valid) {
      //  console.log("新增");
      FormParams.value.id = AssignRowid.value;
      const res = await updateBox(FormParams.value);
      if (res.code == 200) {
        ElMessage.success("分配成功");
        handleClose();
        getList();
      } else {
        ElMessage.error(res.msg);
      }
    }
  });
};
// 控制子表格显示
const showSubTable = ref(false);
// 子表格数据
const subTableData = ref([] as any);
// 当前选中的行
const selectedRow = ref({} as any);
const selectedRowID = ref();
const DelIDS = ref([] as any);
const subTableDatatotal = ref();
const Params = ref({ pageNum: 1, pageSize: 5 } as any);
const idsSelectionChange = ref([]);
const xiangtong = ref(); //工单类型
const workStatusROW = ref(); //工单任务状态
// 点击行时触发
const handleRowClick = async (row: any) => {
  if (selectedRow.value === row) {
    // 如果点击的是同一行，则隐藏子表格
    showSubTable.value = false;
    selectedRow.value = null;
  } else {
    // 否则显示子表格，并加载子表格数据
    xiangtong.value = row.workType;
    selectedRow.value = row;
    workStatusROW.value = row.workStatus;
    //console.log(row, "selectedRow.value");
    showSubTable.value = true;
    selectedRowID.value = row.workNo;
    Params.value.workNo = row.workNo;
    const res = await reportShelfWrongDataList(Params.value);
    subTableData.value = res.data.records!;
    subTableDatatotal.value = res.data.total;

    console.log(res.data.records, "子表格分页列表");
  }
};
// 错架分页
function SelectionChange(selection: any) {
  idsSelectionChange.value = selection.map((item: any) => item.workNo);
  DelIDS.value = selection.map((item: any) => item.id);
}
const Status = (status: number) => {
  const STATUSES = [
    { id: 0, name: "未处理 " },
    { id: 1, name: "已处理" },
    { id: 2, name: "在还书箱上" },
  ];
  const matched = STATUSES.find((item) => item.id === status);
  return matched ? matched.name : "";
};
const SizeChange = async (val: number) => {
  Params.value.pageSize = val;
  Params.value.pageNum = 1;

  const res = await reportShelfWrongDataList(Params.value);
  subTableData.value = res.data.records!;
  subTableDatatotal.value = res.data.total;
};
const CurrentChange = async (val: number) => {
  Params.value.pageNum = val;
  const res = await reportShelfWrongDataList(Params.value);
  subTableData.value = res.data.records!;
  subTableDatatotal.value = res.data.total;
  window.scrollTo({ top: 0, behavior: "smooth" }); // 立即回到顶部，并使用平滑滚动效果
};
const danger = async () => {
  if (DelIDS.value.length == 0) {
    ElMessage.warning("请选择一条数据！");
    return;
  }
  // 检查工单状态是否为待处理（0）
  if (workStatusROW.value !== 0) {
    ElMessage.error("只能删除待处理状态的工单！");
    return;
  }
  // if (workStatusROW.value == 1) {
  //   ElMessage.error("当前正在处理中不可删除");
  //   return;
  // }
  // if (xiangtong.value == 1) {
  //   ElMessage.error("当前自动工单不可删除");
  //   return;
  // }
  const res = await deleteBook(DelIDS.value, selectedRowID.value);
  //console.log(DelIDS.value, selectedRowID.value);

  if (res.code == 200) {
    ElMessage.success("删除成功");
    const res = await reportShelfWrongDataList(Params.value);
    subTableData.value = res.data.records!;
    subTableDatatotal.value = res.data.total;
    getList();
  } else {
    ElMessage.error(res.msg);
    getList();
    const res = await reportShelfWrongDataList(Params.value);
    subTableData.value = res.data.records!;
    subTableDatatotal.value = res.data.total;
  }
};
// 弹框分页

const createpageParams = ref({ pageNum: 1, pageSize: 5 } as any);
const createpagetotal = ref();
const SubTableVisible = ref(false);
const createpageList = ref([] as any);
// 使用 computed 计算 ParamsType 列表
const paramsTypeList = computed(() => {
  if (xiangtong.value === 0) {
    return 1;
  } else if (xiangtong.value === 1) {
    return 0;
  } else {
    return xiangtong.value; // 或者其他默认值
  }
});
const getcreatepageList = async () => {
  createpageParams.value.markerSame = paramsTypeList.value;
  // console.log(
  //   xiangtong.value,
  //   "xiangtong.value",
  //   createpageParams.value,
  //   "createpageParams.value"
  // );
  const res = await createpage(createpageParams.value);
  createpageList.value = res.data.records;
  createpagetotal.value = res.data.total;
};

const SubTableClose = () => {
  SubTableVisible.value = false;
};
const SubTableSizeChange = async (val: number) => {
  createpageParams.value.pageSize = val;
  createpageParams.value.pageNum = 1;
  getcreatepageList();
};
const SubTableCurrentChange = async (val: number) => {
  Params.value.pageNum = val;
  getcreatepageList();
  window.scrollTo({ top: 0, behavior: "smooth" }); // 立即回到顶部，并使用平滑滚动效果
};
const SubTableChangeID = ref([] as any);
function SubTableChange(selection: any) {
  SubTableChangeID.value = selection.map((item: any) => item.id);
}

// 弹框打开
const SubTableopen = async () => {
  getcreatepageList();
  Options();
  SubTableVisible.value = true;
  //console.log(paramsTypeList.value, "paramsTypeList");
};

const sbtTable = async () => {
  if (!SubTableChangeID.value || SubTableChangeID.value.length == 0) {
    ElMessage.warning("请选择一条数据！");
    return;
  }
  if (workStatusROW.value == 1) {
    ElMessage.error("工单正在处理中");
    return;
  }
  if (workStatusROW.value == 2) {
    ElMessage.error("工单已完成");
    return;
  }
  //console.log(SubTableChangeID.value, selectedRowID.value, "新增");
  const res = await handadd(SubTableChangeID.value, selectedRowID.value);
  if (res.code == 200) {
    ElMessage.success(res.msg);
    SubTableVisible.value = false;
    getcreatepageList();
    const ress = await reportShelfWrongDataList(Params.value);
    subTableData.value = ress.data.records!;
    subTableDatatotal.value = ress.data.total;
    getList();
  } else {
    ElMessage.error(res.msg);
  }
  //console.log(res);
};
const tenn = ref();
const Options = async () => {
  const res = await tenOptions(useStore.encryptedData);
  tenn.value = res.data;
  // console.log(res, "10分页列表");

  // console.log(res.data.list, "分页列表");
  // console.log(queryParams.value);
};
const reset = () => {
  queryParams.value = { pageNum: 1, pageSize: 10 };
  getList();
  queryFormRef.value.resetFields();
  queryFormRef.value.clearValidate();
  getcreatepageList();
};
</script>

<template>
  <div class="app-container">
    <el-dialog
      v-model="dialogVisible"
      title="分配还书箱"
      width="500"
      :before-close="handleClose"
      label-width="110px"
    >
      <el-form ref="FormRef" :model="FormParams" :inline="true">
        <el-form-item label-width="110px" label="图书名称" prop="bookName">
          <el-select
            style="width: 210px"
            clearable
            v-model="FormParams.boxId"
            placeholder="请选择还书箱编号"
          >
            <el-option
              v-for="item in BoxList"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button @click="handleClose">取消</el-button>
          <el-button type="primary" @click="sbtAssign"> 确认 </el-button>
        </div>
      </template>
    </el-dialog>
    <div class="search">
      <el-form ref="queryFormRef" :model="queryParams" :inline="true">
        <el-form-item label="工单编号">
          <el-input
            style="width: 210px"
            clearable
            v-model="queryParams.workNo"
            placeholder="请输入工单编号"
          />
        </el-form-item>
        <el-form-item label="任务时间" prop="startTime">
          <el-date-picker
            style="width: 210px"
            v-model="queryParams.Time"
            value-format="YYYY-MM-DD HH:mm:ss"
            type="daterange"
            start-placeholder="开始时间"
            end-placeholder="结束时间"
            :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
            class="!w-220px"
          />
        </el-form-item>
        <el-form-item label="任务状态">
          <el-select
            style="width: 210px"
            clearable
            v-model="queryParams.workStatus"
            placeholder="请选择任务状态"
          >
            <el-option label="待处理" value="0" />
            <el-option label="处理中" value="1" />
            <el-option label="已完成" value="2" />
            <el-option label="已过期" value="3" />
          </el-select>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="getList">搜索</el-button>
          <el-button @click="reset"><i-ep-refresh />重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <el-card>
      <template #header>
        <el-button
          :disabled="isSearchDisabled"
          type="success"
          @click="handleUserExport"
          >导出</el-button
        >
      </template>

      <el-table
        highlight-current-row
        :data="libraryList"
        :border="true"
        @selection-change="handleSelectionChange"
        @row-click="handleRowClick"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column
          type="index"
          width="60"
          label="序号"
          :align="'center'"
          :index="indexMethod"
        />

        <el-table-column
          label="工单编号"
          prop="workNo"
          :align="'center'"
          width="180"
        />

        <el-table-column
          label="工单任务名称"
          prop="workName"
          :align="'center'"
          width="120"
        />
        <el-table-column
          label="工单任务状态"
          prop="workStatus"
          :align="'center'"
          width="120"
        >
          <template #default="{ row }">
            {{ getbooksStatus(row.workStatus) }}
          </template>
        </el-table-column>
        <el-table-column
          label="工单类型"
          prop="workType"
          :align="'center'"
          width="120"
        >
          <template #default="{ row }">
            {{ workTypeStatus(row.workType) }}
          </template>
        </el-table-column>
        <el-table-column
          label="任务开始时间"
          prop="startTime"
          :align="'center'"
          width="120"
        />
        <el-table-column
          label="任务结束时间"
          prop="endTime"
          :align="'center'"
          width="120"
        />
        <el-table-column
          label="执行人"
          prop="operater"
          :align="'center'"
          width="120"
        />
        <el-table-column
          label="错架图书总量"
          prop="wrongNumber"
          :align="'center'"
          width="120"
        />
        <el-table-column
          label="完成图书数量"
          prop="completeNumber"
          :align="'center'"
          width="120"
        />
        <el-table-column
          label="进度"
          prop="schedule"
          :align="'center'"
          width="80"
        >
          <template #default="{ row }">
            {{ (row.schedule * 100).toFixed(0) }}%
          </template>
        </el-table-column>
        <el-table-column
          fixed="right"
          label="操作"
          :align="'center'"
          width="200"
        >
          <template #default="{ row }">
            <div
              style="
                display: flex;
                align-items: center;
                justify-content: center;
              "
            >
              <!-- <el-icon :size="20" v-if="row.taskStatus === 2"
                ><VideoPlay
                  style="font-size: 24px; color: #409eff"
                  class="el-icon-video-play"
                  @click.stop="Start(row)"
              /></el-icon>
              <el-icon :size="20" v-if="row.taskStatus === 1"
                ><VideoPause
                  style="font-size: 24px; color: #409eff"
                  class="el-icon-video-pause"
                  @click.stop="Pause(row)"
              /></el-icon> -->
              <!-- <el-icon
                :size="20"
                v-if="
                  row.taskStatus === 1 
                "
                ><SwitchButton
                  style="font-size: 24px; color: #409eff"
                  class="el-icon-switch-button"
                  @click.stop="Stop(row)"
              /></el-icon> -->
              <el-button
                v-if="row.workStatus === 1"
                type="primary"
                link
                size="small"
                @click.stop="Stop(row)"
                >停止任务</el-button
              >
              <el-button
                v-if="row.workStatus == 0 && row.workType == 0"
                type="primary"
                link
                size="small"
                @click.stop="complete(row.id)"
                >完成</el-button
              >
              <el-button
                v-if="row.workStatus === 0 && row.workType == 1"
                type="primary"
                link
                size="small"
                @click.stop="Assign(row)"
                >分配还书箱</el-button
              >
            </div>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination
        v-if="total > 0"
        style="margin-top: 15px"
        v-model:current-page="queryParams.pageNum"
        v-model:page-size="queryParams.pageSize"
        :page-sizes="[10, 20, 30, 50, 100]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </el-card>
    <el-card v-if="showSubTable" style="margin-top: 8px">
      <el-table
        highlight-current-row
        :data="subTableData"
        :border="true"
        @selection-change="SelectionChange"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column
          type="index"
          width="60"
          label="序号"
          :align="'center'"
          :index="indexMethod"
        />

        <el-table-column label="工单编号" prop="taskNo" :align="'center'" />
        <el-table-column label="图书名称" prop="bookName" :align="'center'" />
        <el-table-column label="图书编码" prop="bookCode" :align="'center'" />
        <el-table-column
          label="正确位置"
          prop="shouldShelf"
          :align="'center'"
        />

        <el-table-column
          label="正确还书点"
          prop="shouldReturnMarker"
          :align="'center'"
          width="100"
        />
        <el-table-column label="错误位置" prop="realShelf" :align="'center'" />
        <el-table-column
          label="错误还书点"
          prop="realReturnMarker"
          :align="'center'"
          width="100"
        />

        <el-table-column label="操作时间" prop="updateTime" :align="'center'" />
        <el-table-column label="图书状态" prop="bookStatus" :align="'center'">
          <template #default="{ row }"> {{ Status(row.bookStatus) }}</template>
        </el-table-column>
        <el-table-column label="备注" prop="remark" :align="'center'" />
      </el-table>
      <el-pagination
        v-if="subTableDatatotal > 0"
        style="margin-top: 15px"
        v-model:current-page="Params.pageNum"
        v-model:page-size="Params.pageSize"
        :page-sizes="[5, 10, 30, 50, 100]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="subTableDatatotal"
        @size-change="SizeChange"
        @current-change="CurrentChange"
      />

      <template #footer>
        <el-button type="success" @click="SubTableopen">新增</el-button>
        <el-button type="danger" @click="danger">删除</el-button>
      </template>
    </el-card>
    <el-dialog
      v-model="SubTableVisible"
      title="新增"
      width="65%"
      :before-close="SubTableClose"
      label-width="110px"
    >
      <div class="search">
        <el-form
          ref="queryFormRef"
          :model="createpageParams"
          :inline="true"
          label-width="70px"
        >
          <el-form-item label="任务编号">
            <el-select
              style="width: 190px"
              clearable
              v-model="createpageParams.taskNo"
              filterable
              allow-create
              default-first-option
              placeholder="请选择或盘点任务编号"
            >
              <el-option
                v-for="item in tenn"
                :key="item.label"
                :label="item.label"
                :value="item.label"
              />
            </el-select>
          </el-form-item>

          <el-form-item label="正确位置">
            <el-input
              style="width: 190px"
              clearable
              v-model="createpageParams.shouldShelf"
              placeholder="请输入正确位置"
            />
          </el-form-item>
          <el-form-item label="错架位置">
            <el-input
              style="width: 190px"
              clearable
              v-model="createpageParams.realShelf"
              placeholder="请输入错架位置"
            />
          </el-form-item>

          <el-form-item label="图书状态">
            <el-select
              clearable
              style="width: 190px"
              v-model="createpageParams.bookStatus"
              allow-create
              default-first-option
              placeholder="请选择图书状态"
            >
              <el-option label="未处理" value="0" />
              <el-option label="已处理" value="1" />
            </el-select>
          </el-form-item>

          <el-form-item>
            <el-button type="primary" @click="getcreatepageList"
              >搜索</el-button
            >
            <el-button @click="resetQuery"><i-ep-refresh />重置</el-button>
          </el-form-item>
        </el-form>
      </div>
      <el-table
        highlight-current-row
        :data="createpageList"
        :border="true"
        @selection-change="SubTableChange"
      >
        <el-table-column type="selection" width="55" />
        <el-table-column label="盘点任务编号" prop="taskNo" :align="'center'" />
        <el-table-column label="图书编号" prop="bookCode" :align="'center'" />

        <el-table-column label="图书名称" prop="bookName" :align="'center'" />
        <el-table-column
          label="应在书架"
          prop="shouldShelf"
          :align="'center'"
        />
        <el-table-column label="实在书架" prop="realShelf" :align="'center'" />
        <el-table-column
          label="应在书架还书点位"
          prop="shouldReturnMarker"
          :align="'center'"
          width="140"
        />
        <el-table-column
          label="实在书架还书点位"
          prop="realReturnMarker"
          :align="'center'"
          width="140"
        />
        <el-table-column label="rfid" prop="rfid" :align="'center'" />
        <el-table-column label="还书箱位置" prop="position" :align="'center'" />
        <el-table-column label="图书状态" prop="bookStatus" :align="'center'">
          <template #default="{ row }"> {{ Status(row.bookStatus) }}</template>
        </el-table-column>
      </el-table>
      <el-pagination
        v-if="createpagetotal > 0"
        style="margin-top: 15px"
        v-model:current-page="createpageParams.pageNum"
        v-model:page-size="createpageParams.pageSize"
        :page-sizes="[5, 10, 30, 50, 100]"
        layout="total, sizes, prev, pager, next, jumper"
        :total="createpagetotal"
        @size-change="SubTableSizeChange"
        @current-change="SubTableCurrentChange"
      />
      <template #footer>
        <el-button type="success" @click="sbtTable">确认</el-button>
      </template>
    </el-dialog>
  </div>
</template>

<style lang="scss" scoped>
* {
  list-style: none;
}

el-select {
  padding-bottom: 100px;
}
</style>
